
package org.sidora.core.util;


import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

/**
 * LoggerProvider
 * @author Enric Tartera, Juan Manuel Gimeno, Roger Masgoret
 * @version 1.0
 */
public final class LoggerProvider {
    private static Logger logger = Logger.getLogger("org.sidora");
    private static FileHandler fh;
    /** Creates a new instance of LoggerProvider */
    private LoggerProvider(){
        
    }
    
    public static Logger getInstance(){
        if (fh==null) configLogger();
        //return db;
        return logger;
    }
    
    
    private static void configLogger(){
        try{
            //SimpleFormatter sf = new SimpleFormatter();
            fh = new FileHandler("sidoraLog.log");
            fh.setFormatter(new SimpleFormatter());
            
        } catch (IOException ex) {
            //logger.log(Level.WARNING, "trouble sneezing", ex);
        }
        logger.addHandler(fh);
        logger.setLevel(Level.ALL);
    }
}
